package com.studyroom.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.studyroom.entity.OrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface OrderItemMapper extends BaseMapper<OrderItem> {
    
    @Select({
        "SELECT oi.*, s.name as snackName,s.image_url as imageUrl",
        "FROM order_items oi",
        "LEFT JOIN snacks s ON oi.snack_id = s.id",
        "WHERE oi.order_id = #{orderId}"
    })
    List<OrderItem> getOrderItems(@Param("orderId") Long orderId);
} 